package com.wiqer.job58;

public class RunTasks {
    public static void main(String[] args) {
        /*创建上下文*/
        TaskContext taskContext=new TaskContext();
        /*开始设计任务编排流程*/
        WTF1 wtf1 =new WTF1();
        WTF2 wtf2 =new WTF2();
        wtf2.setVal("是世界上最好的多吊程调用实现！");
        WTF3 wtf3 =new WTF3();
        wtf3.setVal("你信吗？");

        /*先创建好任务模板，设置真实对象*/
        ExpectTask expectTask1 =new ExpectTask();
        expectTask1.setTask(wtf1);
        ExpectTask expectTask2 =new ExpectTask();
        expectTask2.setTask(wtf2).setTaskName("mergeVal");
        ExpectTask expectTask3 = new ExpectTask();
        expectTask3.setTask(wtf3).setTaskName("mergeValAtPrev");

        /*设置好向下调用的数据结构链路*/
        expectTask1.setTransmitParam(expectTask2,0);
        expectTask2.setTransmitParam(expectTask3,0);
        /*生成代理对象*/
        WTF1 wtf11 =taskContext.createTask(WTF1.class,expectTask1);
        WTF2 wtf22 =taskContext.createTask(WTF2.class,expectTask2);
        WTF3 wtf33 =taskContext.createTask(WTF3.class,expectTask3);
        /*设置代理对象*/
        expectTask1.setTask(wtf11);
        expectTask2.setTask(wtf22);
        expectTask3.setTask(wtf33);
        /*运行*/
        wtf11.setVal("job58");
    }
}
